<?php
namespace App\Repositories\BLL;
use App\Repositories\BLL\Repository;
use App\Models\Wechat\Keyword;

class WelcomeBLL extends Repository
{		
	public function model()
	{
		return Keyword::class;
	}
	
	public function getWelcome(){
		$welcome = $this->findByField('type',1)->first();
		return $welcome;
	}
	
	public function updateWelcome($attributes){
		if(empty($attributes['id'])){
			//新增
			$attributes['key'] = '1';
			$attributes['type'] = 1;
			$result = $this->create($attributes);
		}else{
			//更新
			$result = $this->update($attributes,$attributes['id']);
		}
		return $result;
	}
}